import Home from '@/pages/Home'
import Login from '@/pages/Login'
import Register from '@/pages/Register'
import Search from '@/pages/Search'
import Detail from '@/pages/Detail'
import AddCartSuccess from '@/pages/AddCartSuccess'
import ShopCart from '@/pages/ShopCart'
import Agreement from '@/pages/Agreement'
export const routes=[
    {
        path:'/home',
        component:Home,
       
    },
    {
        path:'/login',
        component:Login,
        //利用路由元信息，即路由记录添加自定义属性
        meta:{

            isHiddenFooter:true
        } 
    },
    {
        path:'/register',
        component:Register,
        meta:{
            isHiddenFooter:true
        }   
    },
    {
        path:'/search',
        name: 'search',
        component:Search,
         meta:{
            isHiddenNav:true//是否显示左侧导航
        }   
    },
    {
        name:'detail',
        path:'/detail/:id',
        component:Detail,
        props:true,//将之前的params参数直接用pros来接收
        // props:(route)=>{
        //     return {id:route.params.id}
        // },
        meta:{
            isHiddenNav:true//是否显示左侧导航
        }
    },
    {
        name:'addCartSuccess',
        path:'/addCartSuccess',
        component:AddCartSuccess
    },
    {
        name:'shopCart',
        path:'/shopCart',
        component:ShopCart
    },
    {
        name:'agreement',
        path:'/agreement',
        component:Agreement,
        meta:{
            isHiddenFooter:true,
            isHiddenHeader:true,
        } 
    },
    {
        path:'/',
        redirect:'/home'   
    }
]